import { TicketStatus, TicketPriority, TicketCategory } from '@/types/ticket';

export const TICKET_STATUS_OPTIONS: { label: string; value: TicketStatus; color: string }[] = [
  { label: '待处理', value: 'open', color: 'blue' },
  { label: '处理中', value: 'in_progress', color: 'orange' },
  { label: '已解决', value: 'resolved', color: 'green' },
  { label: '已关闭', value: 'closed', color: 'gray' },
];

export const TICKET_PRIORITY_OPTIONS: { label: string; value: TicketPriority; color: string }[] = [
  { label: '低', value: 'low', color: 'green' },
  { label: '中', value: 'medium', color: 'blue' },
  { label: '高', value: 'high', color: 'orange' },
  { label: '紧急', value: 'urgent', color: 'red' },
];

export const TICKET_CATEGORY_OPTIONS: { label: string; value: TicketCategory; color: string }[] = [
  { label: '缺陷', value: 'bug', color: 'red' },
  { label: '功能', value: 'feature', color: 'blue' },
  { label: '支持', value: 'support', color: 'green' },
  { label: '维护', value: 'maintenance', color: 'orange' },
];

export const ASSIGNEE_OPTIONS = [
  '张三', '李四', '王五', '赵六', '孙七', '周八', '吴九', '郑十',
  '钱十一', '孙十二', '李十三', '王十四', '张十五', '赵十六', '孙十七', '周十八'
];

export const getStatusLabel = (status: TicketStatus): string => {
  return TICKET_STATUS_OPTIONS.find(option => option.value === status)?.label || status;
};

export const getStatusColor = (status: TicketStatus): string => {
  return TICKET_STATUS_OPTIONS.find(option => option.value === status)?.color || 'default';
};

export const getPriorityLabel = (priority: TicketPriority): string => {
  return TICKET_PRIORITY_OPTIONS.find(option => option.value === priority)?.label || priority;
};

export const getPriorityColor = (priority: TicketPriority): string => {
  return TICKET_PRIORITY_OPTIONS.find(option => option.value === priority)?.color || 'default';
};

export const getCategoryLabel = (category: TicketCategory): string => {
  return TICKET_CATEGORY_OPTIONS.find(option => option.value === category)?.label || category;
};

export const getCategoryColor = (category: TicketCategory): string => {
  return TICKET_CATEGORY_OPTIONS.find(option => option.value === category)?.color || 'default';
}; 